home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / jedit42install.exe / {app} / macros / Clipboard / Copy_Visible_Lines.bsh < prev    next >
Encoding:
Text File  |  2004-08-29  |  901 b   |  35 lines

  1. /*
  2.  * Copy_Visible_Lines.bsh - Copies visible (non-folded) lines from
  3.  * the current buffer to the clipboard.
  4.  *
  5.  * Copyright (C) 2002-2004 Ollie Rutherfurd <oliver@jedit.org>
  6.  *
  7.  * $Id: Copy_Visible_Lines.bsh,v 1.1 2004/08/03 21:31:47 orutherfurd Exp $
  8.  */
  9.  
  10. void copyVisibleLines(View view){
  11.     JEditTextArea textArea = view.getTextArea();
  12.     DisplayManager dm = textArea.getDisplayManager();
  13.  
  14.     StringBuffer buff = new StringBuffer();
  15.     for(int i=0; i < buffer.getLineCount(); i++){
  16.         if(dm.isLineVisible(i))
  17.             buff.append(textArea.getLineText(i)).append('\n');
  18.     }
  19.     Registers.setRegister('$', buff.toString());
  20. }
  21.  
  22. copyVisibleLines(view);
  23.  
  24. /*
  25.  
  26. <listitem>
  27.     <para><filename>Copy_Visible_Lines.bsh</filename></para>
  28.     <abstract><para>Copies the visible lines from the current
  29.         buffer to the Clipboard.  Lines that are not visible
  30.         becuase they are folded are not copied.
  31.     </para></abstract>
  32. </listitem>
  33.  
  34. */
  35.